using System;
using System.Drawing;
using System.Windows.Forms;
using DevExpress.Utils;
using DevExpress.Utils.About;
using DevExpress.XtraBars.Ribbon;

namespace NAGFwk.UI.Controls {
    public partial class HelpControl : RibbonApplicationUserControl {
        Form _aboutPanel;
        public HelpControl() {
            InitializeComponent();
            Load += HelpControl_Load;
        }

        void HelpControl_Load(object sender, EventArgs e) {
            _aboutPanel =
                new AboutForm12(new ProductInfo(ProductKind.Default,
                    new ProductStringInfo("Silkey ERP", "Build Your Own Office. Simply Management.")))
                {
                    TopLevel = false,
                    Parent = splitContainer1.Panel2
                };
            ResizeAbout();
            _aboutPanel.Show();
            splitContainer1.Panel2.Resize += Panel2_Resize;
            ResizeAbout();
        }

        void Panel2_Resize(object sender, EventArgs e) {
            ResizeAbout();
        }
        void ResizeAbout() {
            Panel pnl = _aboutPanel.Parent as Panel;
            _aboutPanel.Location = new Point((pnl.Width - _aboutPanel.Width) / 2, (pnl.Height - _aboutPanel.Height) / 2);
        }
        private void galleryControlGallery1_ItemClick(object sender, GalleryItemClickEventArgs e) {
            string link = string.Format("{0}", e.Item.Tag);
            switch(link) {
                case "LinkHelp": link = AssemblyInfo.DXLinkHelp; break;
                case "LinkGetSupport": link = AssemblyInfo.DXLinkGetSupport; break;
                case "LinkGetStarted": link = AssemblyInfo.DXLinkGetStartedWinGrid; break;
            }
            if(!string.IsNullOrEmpty(link)) ObjectHelper.StartProcess(link);
        }
    }
}
